package com.honghu.villagepost.entity.dao;

import android.os.Parcel;
import android.os.Parcelable;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Transient;

/**
 * 作者: liyu on  2017/11/18 0018 13:55
 * 功能描述: 商品信息
 * 备注:
 */
@Entity(nameInDb = "goods")
public class GoodsEntity implements Parcelable {

    @Id(autoincrement = true)
    private Long uid;//用户id

    private int id;//用户id

    private int cid;//分类id

    private String name;//用户名

    private String catName;//分类名称

    private String goodsSn;//商品货号

    private String majorPic;//商品主图

    private String description;//商品描述

    private int isListing;//是否上架

    private long shopId;//店铺id

    private int shopType;//店铺类型

    private String shopName;//店铺名称

    private String shopLogo;//店铺图片logo

    private double price;//商品价格

    private int stockQuantity;//添加购物车数目

    private String skuId;//商品规格id

    private String color;//颜色

    private String size;//大小

    @Transient
    private boolean isSelect;//是否选中状态

    public GoodsEntity() {
    }

    protected GoodsEntity(Parcel in) {
        if (in.readByte() == 0) {
            uid = null;
        } else {
            uid = in.readLong();
        }
        id = in.readInt();
        cid = in.readInt();
        name = in.readString();
        catName = in.readString();
        goodsSn = in.readString();
        majorPic = in.readString();
        description = in.readString();
        isListing = in.readInt();
        shopId = in.readLong();
        shopType = in.readInt();
        shopName = in.readString();
        shopLogo = in.readString();
        price = in.readDouble();
        stockQuantity = in.readInt();
        skuId = in.readString();
        color = in.readString();
        size = in.readString();
        isSelect = in.readByte() != 0;
    }

    @Generated(hash = 1718170019)
    public GoodsEntity(Long uid, int id, int cid, String name, String catName,
            String goodsSn, String majorPic, String description, int isListing,
            long shopId, int shopType, String shopName, String shopLogo,
            double price, int stockQuantity, String skuId, String color,
            String size) {
        this.uid = uid;
        this.id = id;
        this.cid = cid;
        this.name = name;
        this.catName = catName;
        this.goodsSn = goodsSn;
        this.majorPic = majorPic;
        this.description = description;
        this.isListing = isListing;
        this.shopId = shopId;
        this.shopType = shopType;
        this.shopName = shopName;
        this.shopLogo = shopLogo;
        this.price = price;
        this.stockQuantity = stockQuantity;
        this.skuId = skuId;
        this.color = color;
        this.size = size;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        if (uid == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeLong(uid);
        }
        dest.writeInt(id);
        dest.writeInt(cid);
        dest.writeString(name);
        dest.writeString(catName);
        dest.writeString(goodsSn);
        dest.writeString(majorPic);
        dest.writeString(description);
        dest.writeInt(isListing);
        dest.writeLong(shopId);
        dest.writeInt(shopType);
        dest.writeString(shopName);
        dest.writeString(shopLogo);
        dest.writeDouble(price);
        dest.writeInt(stockQuantity);
        dest.writeString(skuId);
        dest.writeString(color);
        dest.writeString(size);
        dest.writeByte((byte) (isSelect ? 1 : 0));
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<GoodsEntity> CREATOR = new Creator<GoodsEntity>() {
        @Override
        public GoodsEntity createFromParcel(Parcel in) {
            return new GoodsEntity(in);
        }

        @Override
        public GoodsEntity[] newArray(int size) {
            return new GoodsEntity[size];
        }
    };

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getCid() {
        return cid;
    }

    public void setCid(int cid) {
        this.cid = cid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCatName() {
        return catName;
    }

    public void setCatName(String catName) {
        this.catName = catName;
    }

    public String getGoodsSn() {
        return goodsSn;
    }

    public void setGoodsSn(String goodsSn) {
        this.goodsSn = goodsSn;
    }

    public String getMajorPic() {
        return majorPic;
    }

    public void setMajorPic(String majorPic) {
        this.majorPic = majorPic;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public int getIsListing() {
        return isListing;
    }

    public void setIsListing(int isListing) {
        this.isListing = isListing;
    }

    public long getShopId() {
        return shopId;
    }

    public void setShopId(long shopId) {
        this.shopId = shopId;
    }

    public int getShopType() {
        return shopType;
    }

    public void setShopType(int shopType) {
        this.shopType = shopType;
    }

    public String getShopName() {
        return shopName;
    }

    public void setShopName(String shopName) {
        this.shopName = shopName;
    }

    public String getShopLogo() {
        return shopLogo;
    }

    public void setShopLogo(String shopLogo) {
        this.shopLogo = shopLogo;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public int getStockQuantity() {
        return stockQuantity;
    }

    public void setStockQuantity(int stockQuantity) {
        this.stockQuantity = stockQuantity;
    }

    public String getSkuId() {
        return skuId;
    }

    public void setSkuId(String skuId) {
        this.skuId = skuId;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public String getSize() {
        return size;
    }

    public void setSize(String size) {
        this.size = size;
    }

    public boolean isSelect() {
        return isSelect;
    }

    public void setSelect(boolean select) {
        isSelect = select;
    }

    public Long getUid() {
        return this.uid;
    }

    public void setUid(long uid) {
        this.uid = uid;
    }

    public void setUid(Long uid) {
        this.uid = uid;
    }
}
